<?php

namespace App\Http\Requests\Api;

use Dingo\Api\Http\FormRequest;

class MobileDeviceRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        if ($this->isMethod('GET')) {
            return [
                'devices_token' => [
                    'required',
                    'exists:mobile_devices,devices_token',
                ],
            ];
        }

        if ($this->isMethod('POST')) {
            return [
                'devices_token' => [
                    'required',
                ],
                'devices_sys' => [

                ],
                'language' => [
                    'required',
                    'in:sp_cn,td_cn,en',
                ],
                'exchange_rate_id' => [
                    'exists:exchange_rates,id',
                ],
            ];
        }
    }

}
